package vcp.server.utility.timedecision;

import org.joda.time.DateTime;

import vcp.server.utility.SystemClock;

public class TimeDecisionMinute extends TimeDecision
{
	@Override
	public long getUser24HourComplaintNotificationDelay ()
	{
		return 1000 * 60 * 60;
	}

	@Override
	public long getUser24HourComplaintNotification ()
	{
		return 24 * 1000 * 60 * 60;
	}

	@Override
	public long getEndDayReservationCleanUpTaskDelay ()
	{
		return 24 * 1000 * 60 * 60;
	}

	@Override
	public long getEndDayReservationCleanUpTask ()
	{
		return 24 * 1000 * 60 * 60;
	}

	@Override
	public long getEndWeekStatisticsTaskDelay ()
	{
		return 24 * 1000 * 60 * 60 * 7;
	}

	@Override
	public long getEndWeekStatisticsTask ()
	{
		return 24 * 1000 * 60 * 60 * 7;
	}

	@Override
	public long getReservedLotReminderTaskDelay ()
	{
		DateTime currentTime = SystemClock.getClockInstance().getSystemDateTime();
		int newTime = ( ( currentTime.getMinuteOfHour() / 10 ) + 1 ) * 10;
		DateTime roundedTime = newTime == 60
											? currentTime.plus(1).withMinuteOfHour(0)
											: currentTime.withMinuteOfHour(newTime);

		int minuteUntil = roundedTime.getMinuteOfHour() - currentTime.getMinuteOfHour();
		minuteUntil = minuteUntil < 0
										? 0
										: minuteUntil;

		return minuteUntil * 60 * 1000;
	}

	@Override
	public long getReservedLotReminderTask ()
	{
		return 10 * 1000 * 60;
	}

	@Override
	public long getEndOfSubscriptionTaskDelay ()
	{
		return 0;
	}

	@Override
	public long getEndOfSubscriptionTask ()
	{
		return 10 * 1000 * 60;
	}

	@Override
	public int getIncreamentalInterval ()
	{
		return 1;
	}

	@Override
	public long getEndDayStatisticsTaskDelay ()
	{
		return 1000 * 60 * 60 * 24;
	}

	@Override
	public long getEndDayStatisticsTask ()
	{
		return 1000 * 60 * 60 * 24;
	}

}
